﻿using System.Collections.Generic;
using System.Data.Objects.DataClasses;
using System.Diagnostics;
using System.Linq;

namespace Model
{
    [DebuggerDisplay("{Name}")]
    public partial class Assembly : EntityObject
    {

    }

    #region CallGraphEdge

    public partial class CallGraphEdge : EntityObject
    {

    }

    [DebuggerDisplay("{Caller_AssemblyName}->{Callee_AssemblyName}")]
    public partial class CallGraphEdge_AssemblyDependency : EntityObject
    {

    }

    [DebuggerDisplay("{Caller_MemberName}->{Callee_MemberName}")]
    public partial class CallGraphEdge_MemberDependency : EntityObject
    {

    }

    [DebuggerDisplay("{Caller_TypeName}->{Callee_TypeName}")]
    public partial class CallGraphEdge_TypeDependency : EntityObject
    {

    }

    [DebuggerDisplay("{Caller_ModuleName}->{Callee_ModuleName}")]
    public partial class CallGraphEdge_ModuleDependency : EntityObject
    {

    }

    [DebuggerDisplay("{Caller_NamespaceName}->{Callee_NamespaceName}")]
    public partial class CallGraphEdge_NamespaceDependency : EntityObject
    {

    }

    #endregion CallGraphEdge

    [DebuggerDisplay("{Name}")]
    public partial class Category : EntityObject
    {

    }

    [DebuggerDisplay("{Name}")]
    public partial class Category_Subcharacteristic : EntityObject
    {

    }

    public partial class FxCopIssue : EntityObject
    {

    }

    public partial class FxCopResolution : EntityObject
    {

    }

    public partial class Mapping : EntityObject
    {

    }

    [DebuggerDisplay("{Name}")]
    public partial class Member : EntityObject
    {

    }

    public partial class Message : EntityObject
    {
        public double GetWeight()
        {
            double weight = 0;
            foreach (var mapping in this.Rule.Mappings)
            {
                if (mapping.Category.QualityProfileItem != null)
                    weight += mapping.Category.QualityProfileItem.Weight;
                //else weight += 0;
            }
            return weight / 100.0 * this.Message_FxCopMessage.FxCopIssues.First().Certainty;
        }

        public IEnumerable<Category_Subcharacteristic> GetSubcharacteristics()
        {
            List<Category_Subcharacteristic> value = new List<Category_Subcharacteristic>();
            foreach (var mapping in this.Rule.Mappings)
            {
                value.Add(mapping.Category.Category_Subcharacteristic);
            }
            return value;
        }
    }

    public partial class Message_FxCopMessage : EntityObject
    {

    }

    [DebuggerDisplay("{Name}")]
    public partial class Module : EntityObject
    {

    }

    [DebuggerDisplay("{Name}")]
    public partial class Namespace : EntityObject
    {

    }

    [DebuggerDisplay("{Name}")]
    public partial class Project : EntityObject
    {

    }

    [DebuggerDisplay("{Name}")]
    public partial class QualityCharacteristic : EntityObject
    {

    }


    public partial class Rule : EntityObject
    {
        public override string ToString()
        {
            string value = "Rule: Id=" + this.Id;
            value += " Mappings={";
            foreach (var mapping in this.Mappings)
            {
                value += mapping.ToString() + ", ";
            }
            value.TrimEnd(' ', ',');
            value += "}";
            value += " Messages={";
            foreach (var message in this.Messages)
            {
                value += message.ToString() + ", ";
            }
            value.TrimEnd(' ', ',');
            value += "}";
            return value;
        }
    }

    public partial class Rule_FxCopRule : EntityObject
    {
        public override string ToString()
        {
            string value = "Rule_FxCopRule: Id=" + this.Id
                + " Category=" + this.Category
                + " Description=" + this.Description
                + " Email=" + this.Email
                + " FileName=" + this.FileName
                + " FileVersion=" + this.FileVersion
                + " MessageLevelCertainty=" + this.MessageLevelCertainty.ToString()
                + " MessageLevelContent=" + this.MessageLevelContent
                + " Name=" + this.Name
                + " Owner=" + this.Owner
                + " TypeName=" + this.TypeName
                + " Url=" + this.Url;
            value += " Rule=" + (this.Rule == null ? "NULL" : "{" + this.Rule.ToString() + "}");
            value += " FxCopResolutions={";
            foreach (var fxCopResolution in this.FxCopResolutions)
            {
                value += fxCopResolution.ToString() + ", ";
            }
            value.TrimEnd(' ', ',');
            value += "}";
            return value;
        }
    }

    [DebuggerDisplay("{Name}")]
    public partial class Type : EntityObject
    {

    }

    #region QualityProfile

    [DebuggerDisplay("{CategoryName} {Weight}")]
    public partial class QualityProfileItem : EntityObject { }

    [DebuggerDisplay("{Value}")]
    public partial class Question : EntityObject { }

    [DebuggerDisplay("{Value} IsChecked:{IsChecked}")]
    public partial class Answer : EntityObject { }

    [DebuggerDisplay("{AnswerQuestionValue} {AnswerValue}[{Answer.IsChecked}] --{Weight}--> {CategoryName}")]
    public partial class Effect : EntityObject { }

    #endregion QualityProfile
}